package weboffice

import (
	"fmt"
	"time"
)

type Logger interface {
	Info(format string, args ...any)
	Error(format string, args ...any)
}

func DefaultLogger() Logger {
	return &stdLogger{}
}

type stdLogger struct {
}

func (*stdLogger) Info(format string, args ...any) {
	tm := time.Now().Format("2006-01-02T15:04:05.000")
	println(tm, "[INFO]", fmt.Sprintf(format, args...))
}

func (*stdLogger) Error(format string, args ...any) {
	tm := time.Now().Format("2006-01-02T15:04:05.000")
	println(tm, "[ERROR]", fmt.Sprintf(format, args...))

}

type noopLogger struct {
}

func (*noopLogger) Info(format string, args ...any) {
}

func (*noopLogger) Error(format string, args ...any) {
}
